IF OBJECT_ID('ssf.fs_ntfs_dir') IS NOT NULL
	DROP FUNCTION [ssf].[fs_ntfs_dir]
GO

CREATE FUNCTION [ssf].[fs_ntfs_dir] (
	@path NVARCHAR(4000)
	, @search_pattern NVARCHAR(4000)
	, @recursive BIT)
RETURNS TABLE (
	directory_fl BIT
	, name NVARCHAR(4000)
	, path NVARCHAR(4000)
	, relative_file_path NVARCHAR(4000)
	, parent_name NVARCHAR(4000)
	, parent_path NVARCHAR(4000)
	, relative_parent_path NVARCHAR(4000)
	, root_name NVARCHAR(4000)
	, root_path NVARCHAR(4000)
	, size BIGINT
	, extension NVARCHAR(4000)
	, read_only_fl BIT
	, creation_time DATETIME
	, last_access_time DATETIME
	, last_write_time DATETIME)
WITH EXECUTE AS CALLER
EXTERNAL NAME [FileSystem].[SQLServerFramework.NTFS].[Dir]
GO
